<template>
  <div class="div-temp">
    <!-- <div class="center-s clearfix">
    <el-button type="primary" plain class="clickBack" @click="returnBack()">返回</el-button>
    </div> -->
    <div class="div-mau" style="padding:35px 80px;">
      <el-form :model="dataForm" :rules="dataRule" ref="dataForm" v-loading="dataListLoading" @keyup.enter.native="dataFormSubmit()" label-width="140px">
          <el-row>
            <el-col :span="12">
                <el-form-item label="项目名称" prop="projectName">
                  <el-input v-model="dataForm.projectName"  placeholder="请填写项目名称"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="项目种类">
                  <el-input v-model="dataForm.category"  placeholder="请填写项目种类"></el-input>
                </el-form-item>
              </el-col>
                <el-col :span="12">
                <el-form-item label="项目编号">
                  <el-input v-model="dataForm.serialNumber"  placeholder="请填写项目编号"></el-input>
                </el-form-item>
              </el-col>
                <el-col :span="12">
                  <el-form-item label="项目状态" prop="statusTag">
                    <el-select v-model="dataForm.statusTag" style="width:100%" >
                      <el-option
                        v-for="item in certificateTypes"
                        :key="item.value"
                        :label="item.label"
                        :value="item.value"
                        >
                      </el-option>
                    </el-select>
                  </el-form-item>
              </el-col>
              <el-col :span="12">
                  <el-form-item label="项目负责人" class="baoguanren" prop="deptId">
                    <el-select v-model="memberTypeId" placeholder="证书类型" style="width: 20.5%" @change="changeMemberTypeId">
                      <el-option v-for="item in memberTypeOptions"
                                 :key="item.id"
                                 :label="item.name"
                                 :value="item.id">
                      </el-option>
                    </el-select>
                    <el-tree-select
                      v-if="memberTypeId === 1"
                      style="width:39%;"
                      :data="treeData"
                      v-model="dataForm.deptId"
                      node-key="id"
                      placeholder="请选择项目负责人"
                      :clearable="true"
                      class="baoguanren"
                      @change="keepDeptChange"
                      ref="casc"
                    />
                    <el-select v-if="memberTypeId === 1" v-model="dataForm.employeeId" @change="employeesChange" filterable placeholder="请选择负责人" style="width:39%">
                      <el-option
                        v-for="item in employees"
                        :key="item.id"
                        :clearable="true"
                        :label="item.name"
                        :value="item.id">
                      </el-option>
                    </el-select>
                    <el-select v-if="memberTypeId === 2" v-model="dataForm.employeeId" @change="employeesChange" filterable  placeholder="请选择负责人" style="width:78.5%">
                      <el-option
                        v-for="item in employeesOptions"
                        :key="item.id"
                        :clearable="true"
                        :label="item.name"
                        :value="item.id">
                      </el-option>
                    </el-select>
                  </el-form-item>
              </el-col>

              <el-col :span="12">
                <el-form-item label="负责人手机号">
                  <el-input v-model="dataForm.employeeMobile" :readonly="this.readonly" oninput="value=value.replace(/[^\d]/g,'')" maxlength="11" placeholder="请填写手机号"></el-input>
                </el-form-item>
              </el-col>

              <el-col :span="12">
                <el-form-item label="建设单位">
                  <el-input v-model="dataForm.constructCompany"  placeholder="请填写建设单位"></el-input>
                </el-form-item>
              </el-col>
               <el-col :span="12">
                <el-form-item label="项目地址">
                  <el-input v-model="dataForm.address"  placeholder="请填写项目地址"></el-input>
                </el-form-item>
              </el-col>

             <el-col :span="12">
                <el-form-item label="合同开始日期">
                  <el-date-picker type="date" v-model="dataForm.contractStartTime" placeholder="请选择合同开始日期" :picker-options="pickerOptionsValidityEndTimeA" style="width:100%"></el-date-picker>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="合同结束日期">
                  <el-date-picker type="date" v-if="!checked" v-model="dataForm.contractEndTime" format="yyyy-MM-dd" placeholder="请选择合同结束日期" style="width:100%" @blur="blurValidityEndTime" :picker-options="pickerOptionsValidityEndTime"></el-date-picker>
                </el-form-item>
              </el-col>


             <el-col :span="12">
                <el-form-item label="实际开始日期">
                  <el-date-picker type="date" v-model="dataForm.actualStartTime" placeholder="请选择实际开始日期" :picker-options="pickerOptionsValidityEndTimeB" style="width:100%"></el-date-picker>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="实际结束日期">
                  <el-date-picker type="date" v-if="!checked" v-model="dataForm.actualEndTime" format="yyyy-MM-dd" placeholder="请选择实际结束日期" style="width:100%" @blur="blurValidityEndTimeB" :picker-options="pickerOptionsValidityEndTimeb"></el-date-picker>
                </el-form-item>
              </el-col>

                <el-col :span="12">
                <el-form-item label="项目金额（万元）">
                  <el-input v-model="dataForm.price" oninput="value=value.replace(/[^0-9.]/g,'')"  placeholder="请填写项目金额"></el-input>
                </el-form-item>
              </el-col>

            <el-col :span="24">
              <el-form-item label="备注">
                <el-input type="textarea" :rows="6" v-model="dataForm.remark" placeholder="请填写备注"></el-input>
              </el-form-item>
            </el-col>

            <el-col :span="24">
              <el-form-item label="附件">
                <el-upload
                 class="upload-ss"
                 :action="uploadUrl()"
                  accept =".jpg,.png"
                  :headers="myHeader"
                  :limit="5"
                  multiple
                  :disabled="disabledImg"
                  :show-file-list="true"
                  :on-success="onCertiSuccess"
                  :on-exceed="onExceedImg"
                  :file-list="img"
                  :on-error="onError"
                  ref="certiUpload"
                  list-type="picture-card"
                 >
                 <i slot="default" class="el-icon-plus"></i>
                 <div @click="clickFilets(file)" class="div-ssup" slot="file" slot-scope="{file}">
                <img
                  class="el-upload-list__item-thumbnail"
                  :src="file.url" alt=""
                >
                <span class="el-upload-list__item-actions">
                 <span
                 class="el-upload-list__item-preview"
                 @click="imgHandlePictureCardPreview(file)"
                >
                <i class="el-icon-zoom-in"></i>
               </span>
               <span
                 v-if="!disabled"
                 class="el-upload-list__item-delete delete-sse"
                 @click.stop="imgHandleRemove(file)"
               >
                 <i class="el-icon-delete"></i>
               </span>
              </span>
             </div>
             </el-upload>
             <el-dialog :visible.sync="imageDialogVisible">
             <img width="100%" :src="imgDialogImageUrl" alt="">
             </el-dialog>
             <!-- 上传图片 -->
              </el-form-item>
            </el-col>

          </el-row>
          <el-form-item style="text-align:center;padding-right:120px;">
            <el-button class="button-see" size="mini" plain @click="gotoRouteHandle()">返 回</el-button>
            <el-button class="button-see" size="mini" type="primary" @click="dataFormSubmit()">保 存</el-button>
          </el-form-item>
      </el-form>
      <el-dialog
      title="错误提示"
      :visible.sync="dataFormSubmitCenterDialogVisible"
      width="30%"
      center>
      <span class="cuowu">上述必填信息有误，请填写完整！</span>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dataFormSubmitCenterDialogVisible = false">关 闭</el-button>
      </span>
      </el-dialog>
    </div>
    <!-- 新增人员组件 -->
    <!-- <certificate-update v-if="addOrUpdateVisible" ref="addOrUpdate"></certificate-update> -->
  </div>
</template>

<script>
  import Vue from 'vue'
  import ElTreeSelect from '@/components/treeSelect/index.vue'
  import merge from 'lodash/merge'
   // 验证手机号的规则;
  var checkMobile = (rule, value, cb) => {
      // 验证手机号的正则表达式
    const regMobile = /^(0|86|17951)?(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57])[0-9]{8}$/
    if (regMobile.test(value)) {
      return cb()
    }
    cb(new Error('请输入合法的手机号'))
  }
export default {
    data () {
      return {
        memberTypeId: 1,
        memberTypeOptions: [
          {id: 1, name: '在职员工'},
          {id: 2, name: '挂靠'}
        ],
        employeesOptions: [],
        manualupdate: 0,
        dataFormSubmitCenterDialogVisible: false,
        imageDialogVisible: false,
        imgDialogImageUrl: '',
        disabled: false,
        readonly: false,
        disabledImg: false,
        readonlyEdit: false,
        visible: false,
        checked: false,
        dataEdit: [],
        certificateTypes: [
          {label: '中标', value: 1},
          {label: '待建', value: 2},
          {label: '在建', value: 3},
          {label: '竣工', value: 4}
        ],
        addOrUpdateVisible: false,
        dataForm: {
         	 actualEndTime: '',
	         actualStartTime: '',
	         address: '',
	         category: '',
	         constructCompany: '',
	         contractEndTime: '',
	         contractStartTime: '',
	         deptId: '',
	         employeeId: '',
	         employeeMobile: '',
	         fileList: [],
	         price: '',
	         projectName: '',
	         remark: '',
	         serialNumber: '',
	         statusTag: 1
        },
        optionsPayment: [{
          value: 1,
          label: '是'
        }, {
          value: 0,
          label: '否'
        }],
        payment: '',
        optionsAT: [{
          value: 1,
          label: '是'
        }, {
          value: 0,
          label: '否'
        }],
        valueAT: '',
        pickerOptionsValidityEndTime: {
          disabledDate: (time) => {
            return time.getTime() < this.dataForm.contractStartTime
          }
        },
        pickerOptionsValidityEndTimeb: {
          disabledDate: (time) => {
            return time.getTime() < this.dataForm.actualStartTime
          }
        },
        pickerOptionsValidityEndTimeA: {},
        pickerOptionsValidityEndTimeB: {},
        dataRule: {
          mobile: [
           // { required: true, message: '请填写手机号', trigger: 'blur'  },
            { len: 11, validator: checkMobile, message: '请填写正确的手机号', trigger: 'blur'}
          ],
          deptId: [
            { required: true, message: '请选择项目负责人', trigger: 'blur' }
          ],
          projectName: [
            { required: true, message: '请填写项目名称', trigger: 'blur' }
          ],
          statusTag: [
            { required: true, message: '请选择项目状态', trigger: 'blur' }
          ]
        },
        treeData: [],
        certiPicList: [],
        constractPicList: [],
        dataListLoading: false,
        payPic: [],
        jobs: [],
        img: [],
        dataListName: {},
        limitNum: 5, // 上传excell时，同时允许上传的最大数
        jobName: '',
        confInfos: [],
        professions: [],
        employees: [],
        dialogImageUrl: '',
        dialogVisible: false,
        disabled: false,
        showList: true,
        area: {11: '北京',
          12: '天津',
          13: '河北',
          14: '山西',
          15: '内蒙古',
          21: '辽宁',
          22: '吉林',
          23: '黑龙江',
          31: '上海',
          32: '江苏',
          33: '浙江',
          34: '安徽',
          35: '福建',
          36: '江西',
          37: '山东',
          41: '河南',
          42: '湖北',
          43: '湖南',
          44: '广东',
          45: '广西',
          46: '海南',
          50: '重庆',
          51: '四川',
          52: '贵州',
          53: '云南',
          54: '西藏',
          61: '陕西',
          62: '甘肃',
          63: '青海',
          64: '宁夏',
          65: '新疆',
          71: '台湾',
          81: '香港',
          82: '澳门',
          91: '国外'
        }
      }
    },
    props: {
      dateFrom: {
        type: Object
            // required: true
      },
      isField: {
        type: Boolean
            // required: true
      },
      dataListForm: {
        type: Object
      },
      srcListUpload: {
        type: Array
      },
      editmodification: {
        type: Boolean
      }
    },
    components: {
      ElTreeSelect
    },
    watch: {
    },
    computed: {
      myHeader () {
        return {
          'token': Vue.cookie.get('token')
        }
      }
    },
    created () {
      this.keepDeptDataEdit()
      this.initOrgTree()
      this.initJobs()
      this.dataListForms()
      this.keepDeptChange()
      this.jobChange()
    },
    methods: {
      blurValidityEndTime () {
        if (this.dataForm.contractEndTime !== '') {
          this.pickerOptionsValidityEndTimeA = {
            disabledDate: (time) => {
              return time.getTime() > this.dataForm.contractEndTime
            }
          }
        } else {
          this.pickerOptionsValidityEndTimeA = {}
        }
      },
      blurValidityEndTimeB () {
        if (this.dataForm.actualEndTime !== '') {
          this.pickerOptionsValidityEndTimeB = {
            disabledDate: (time) => {
              return time.getTime() > this.dataForm.actualEndTime
            }
          }
        } else {
          this.pickerOptionsValidityEndTimeB = {}
        }
      },
      dataFormSubmit () {
/*       if(this.srcListUpload){
      // console.log(this.certiPicList);
      } */

        if (!this.dataListForm) {
          this.certiPicList.forEach(i => {
            this.dataForm.fileList.push(i.response.fileName)
          })
          this.$refs['dataForm'].validate((valid) => {
            if (valid) {
              this.$http({
                url: this.$http.adornUrl('/project/projectConfig/save'),
                method: 'post',
                data: this.$http.adornData({
	          'actualEndTime': this.$dateFormat(this.dataForm.actualEndTime),
	          'actualStartTime': this.$dateFormat(this.dataForm.actualStartTime),
	          'address': this.dataForm.address,
	          'category': this.dataForm.category,
	          'constructCompany': this.dataForm.constructCompany,
	          'contractEndTime': this.$dateFormat(this.dataForm.contractEndTime),
	          'contractStartTime': this.$dateFormat(this.dataForm.contractStartTime),
	          'deptId': this.dataForm.deptId,
	          'employeeId': this.dataForm.employeeId,
	          'employeeMobile': this.dataForm.employeeMobile,
	          'fileList': this.dataForm.fileList,
	          'price': this.dataForm.price,
	          'projectName': this.dataForm.projectName,
	          'remark': this.dataForm.remark,
	          'serialNumber': this.dataForm.serialNumber,
	          'statusTag': this.dataForm.statusTag
                })
              }).then(({data}) => {
                if (data && data.code === 0) {
                  this.$message({
                    message: '添加成功',
                    type: 'success',
                    duration: 1500,
                    onClose: () => {
                      this.dataListLoading = false
                      this.$refs.dataForm.resetFields()
                      this.$emit('routerBack')
                    }
                  })
                } else {
                  this.$message.error(data.msg)
                  this.dataListLoading = false
                }
              })
            }
          })
        } else {
          var imgArr = []
          this.dataForm.fileList.forEach(i => {
            imgArr.push(i.fileName)
          })
          this.$refs['dataForm'].validate((valid) => {
            if (valid) {
              this.$http({
                url: this.$http.adornUrl('/project/projectConfig/update'),
                method: 'post',
                data: this.$http.adornData({
                  'id': this.dataForm.id,
	          'actualEndTime': this.$dateFormat(this.dataForm.actualEndTime),
	          'actualStartTime': this.$dateFormat(this.dataForm.actualStartTime),
	          'address': this.dataForm.address,
	          'category': this.dataForm.category,
	          'constructCompany': this.dataForm.constructCompany,
	          'contractEndTime': this.$dateFormat(this.dataForm.contractEndTime),
	          'contractStartTime': this.$dateFormat(this.dataForm.contractStartTime),
	          'deptId': this.dataForm.deptId,
	          'employeeId': this.dataForm.employeeId,
	          'employeeMobile': this.dataForm.employeeMobile,
	          'fileList': imgArr,
	          'price': this.dataForm.price,
	          'projectName': this.dataForm.projectName,
	          'remark': this.dataForm.remark,
	          'serialNumber': this.dataForm.serialNumber,
	          'statusTag': this.dataForm.statusTag
                })
              }).then(({data}) => {
                if (data && data.code === 0) {
                  this.$message({
                    message: '修改成功',
                    type: 'success',
                    duration: 1500,
                    onClose: () => {
                      this.dataListLoading = false
                      this.$refs.dataForm.resetFields()
                      this.$emit('routerBack')
                    }
                  })
                } else {
                  this.$message.error(data.msg)
                  this.dataListLoading = false
                }
              })
            }
          })
        }
      },
      changeaffiliationIncome (val) {
        val = val.replace(/(^\s*)|(\s*$)/g, '')
        if (!val) {
          this.a = ''
          return
        }
        var reg = /[^\d.]/g

                // 只能是数字和小数点，不能是其他输入
        val = val.replace(reg, '')

                // 保证第一位只能是数字，不能是点
        val = val.replace(/^\./g, '')
              // 小数只能出现1位
        val = val.replace('.', '$#$').replace(/\./g, '').replace('$#$', '.')
              // 小数点后面保留2位
        val = val.replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3')
        this.dataForm.affiliationExpend = val
  },
      clickEfocus () {
      // this.pickerOptionsValidityEndTime.disabledDate(this.dataForm.)
      },
      /**
   * 中国身份证详细验证
   */
  chinaIdentityValid: (rule, value, callback) => {
    if (!value) {
      return callback()
    }
    let city = {
      11: '北京',
      12: '天津',
      13: '河北',
      14: '山西',
      15: '内蒙古',
      21: '辽宁',
      22: '吉林',
      23: '黑龙江 ',
      31: '上海',
      32: '江苏',
      33: '浙江',
      34: '安徽',
      35: '福建',
      36: '江西',
      37: '山东',
      41: '河南',
      42: '湖北 ',
      43: '湖南',
      44: '广东',
      45: '广西',
      46: '海南',
      50: '重庆',
      51: '四川',
      52: '贵州',
      53: '云南',
      54: '西藏 ',
      61: '陕西',
      62: '甘肃',
      63: '青海',
      64: '宁夏',
      65: '新疆',
      71: '台湾',
      81: '香港',
      82: '澳门',
      91: '国外'
    }
    if (!value || !/^\d{6}(18|19|20)?\d{2}(0[1-9]|1[012])(0[1-9]|[12]\d|3[01])\d{3}(\d|X)$/i.test(value)) {
      callback(new Error('身份证号格式错误'))
    } else if (!city[value.substr(0, 2)]) {
      callback(new Error('身份证号格式错误'))
    } else {
      // 18位身份证需要验证最后一位校验位
      if (value.length === 18) {
        const code = value.split('')
        // ∑(ai×Wi)(mod 11)
        // 加权因子
        const factor = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2]
        // 校验位
        const parity = [1, 0, 'X', 9, 8, 7, 6, 5, 4, 3, 2]
        let sum = 0
        let ai = 0
        let wi = 0
        for (let i = 0; i < 17; i++) {
          ai = code[i]
          wi = factor[i]
          sum += ai * wi
        }
        if (parity[sum % 11].toString() !== code[17]) {
          callback(new Error('输入的身份证号有误'))
        }
      }
    }
    callback()
  },
      imgHandleRemove (file) {
        let Arr = this.$refs['certiUpload'].uploadFiles
        let index = Arr.indexOf(file)
        let num = 0
        this.$refs['certiUpload'].uploadFiles.map(item => {
          if (item.uid == file.uid) {
            this.$refs['certiUpload'].uploadFiles.splice(num, 1)
          }
          num++
        })

        this.certiPicList.forEach((i, index) => {
          if (i.uid == file.uid) {
            this.certiPicList.splice(index, 1)
          }
        })
      },
      imgHandlePictureCardPreview (file) {
        this.imgDialogImageUrl = file.url
        this.imageDialogVisible = true
      },
      // clickfocsus(){
      // this.pickerOptionsValidityEndTime.disabledDate(this.dataForm.validityEndTime) =
      // },
      // 返回上一层
      returnBack () {
        this.$emit('routerBack')
        this.$refs.dataForm.resetFields()
      },
      dataListForms () {
        this.dataForm = {...this.dataForm, ...this.dataListForm}
        this.img = []
        if (this.dataListForm) {
          this.disabledImg = true
/*       this.dataListForm.fileList.forEach(i=>{
      this.img.push({
        url:i
      })
      }) */
        }

      // if(this.dataListForm){
      // this.dataForm.id = this.dataListForm.employeeId
      // this.dataForm.releaseTime = new Date(this.dataListForm.releaseTime)
      // this.dataForm.borrowTime = new Date(this.dataListForm.borrowTime)
      // if(this.dataForm.certificateType == 1){
      // this.readonly = true
      // }
      // if(this.dataForm.certificateType ==3){
      // this.readonlyEdit = true
      // }
      // }
      },
      handleRemove (file) {
      },
      handlePictureCardPreview (file) {
        this.dialogImageUrl = file.url
        this.dialogVisible = true
      },
      handleDownload (file) {
      },
      init (tenantId) {
        this.tenantId = tenantId
      },
      onExceedImg (files, fileList) {
        this.$message.warning(`只能选择5个文件，当前共选择了 ${files.length + fileList.length} 个`)
      },
      onRemove (file, fileList) {
      },
      onCertiSuccess (response, file, fileList) {
        this.imgDialogImageUrl = response.remoteUrl + response.fileName
        this.certiPicList = fileList
        console.log(this.certiPicList)
      },
      clickFilets (file) {
        this.imgHandlePictureCardPreview(file)
      },
      onContractSuccess (response, file, fileList) {
        this.payPic = fileList
      },
      onError (err, file, fileList) {
        this.$message.error('上传失败')
      },
      uploadUrl () {
        return this.$http.adornUrl(`/certificate/certificateInfo/upload`)
      },
      initJobs () {
        this.$http({
          url: this.$http.adornUrl('/certificate/certificateInfo/getJobs'),
          method: 'get',
          params: {}
        }).then(({data}) => {
          if (data && data.length > 0) {
            this.jobs = data
          }
        })
      },
      changeCertificateType (value) {
      // console.log(123);
      // console.log(value);
        if (value == 3 || 2) {
          this.readonly = false
        }
        if (this.dataForm.certificateType == 3) {
          this.readonlyEdit = true
        }
      },
      jobChange (value) {
        if (!this.dataListForm) {
          this.confInfos = []
          this.professions = []
      // this.dataForm.profession = ''
          this.$http({
            url: this.$http.adornUrl('/certificate/certificateInfo/getJobsConf'),
            method: 'get',
            params: this.$http.adornParams({
              'type': this.dataForm.pIdType
            })
          }).then(({data}) => {
            if (data && data.length > 0) {
              this.confInfos = data
            }
          })
        } else {
          this.confInfos = []
          this.professions = []
          value = this.dataForm.pIdType
          this.$http({
            url: this.$http.adornUrl('/certificate/certificateInfo/getJobsConf'),
            method: 'get',
            params: this.$http.adornParams({
              'type': value
            })
          }).then(({data}) => {
            if (data && data.length > 0) {
              this.confInfos = data
            }
          })
        }
      },
      gotoRouteHandle () {
        if (!this.dataListForm) {
          this.$emit('routerBack')
        } else {
          this.$emit('isDateEdit')
        }

        this.$refs.dataForm.resetFields()
      },
      keepDeptDataEdit () {
        this.$http({
          url: this.$http.adornUrl('/certificate/employeeInfo/getEmployeeInfos'),
          // url: this.$http.adornUrl('/certificate/employeeInfo/holders'),
          method: 'get',
          params: this.$http.adornParams({
            'deptId': 0
          })
        }).then(({data}) => {
          if (data.length > 0) {
            this.dataEdit = data
          // console.log(data);
          }
        })
      },
      changeName (id) {
        this.$http({
          url: this.$http.adornUrl('/certificate/employeeInfo/info/' + id),
          method: 'get'
        }).then(({data}) => {
        // this.dataListName = data.e
        // this.dataForm.name = data.e.name
          this.dataForm.employeeMobile = data.e.mobile
          if (this.dataForm.employeeMobile !== '') {
            this.readonly = true
          }
        })
      },
      changeFriendshipEmployeeId (id) {
        this.$http({
          url: this.$http.adornUrl('/certificate/employeeInfo/info/' + id),
          method: 'get'
        }).then(({data}) => {
      // this.dataListName = data.e
          this.dataForm.friendshipMobile = data.e.mobile
          this.readonly = true
        })
      },
      keepDeptChange (id, item) {
        // console.log(2);
        // this.employees = []
        // this.dataForm.keepUserId = ''
        this.$http({
          url: this.$http.adornUrl('/certificate/employeeInfo/list'),
          method: 'get',
          params: this.$http.adornParams({
            'filterFlag': 0,
            'deptId': id,
            'page': 1,
            'limit': 1000,
            'status': 1
          })
        }).then(({data}) => {
          if (data.code == 0) {
            this.employees = data.page.list
            // 默认保管部门
            if (!this.dataListForm) {
            // this.dataForm.keepUserId = data.page.list[0].id
            } else {
              // this.dataForm.keepUserId = this.dataListForm.keepUserId
            }
          }
        })
      },
      employeesChange (item) {
        // console.log(item);
        this.$http({
          url: this.$http.adornUrl('/certificate/employeeInfo/info/' + item),
          method: 'get'
        }).then(({data}) => {
          if (data.code == 0) {
            this.dataForm.deptId = data.e.deptId
          }
        })
        this.dataForm.deptId = item.deptId

        this.changeName(item)
      },
      changeMemberTypeId (option) {
        if (option === 2) {
          this.$http({
            url: this.$http.adornUrl('/ent/member/list'),
            method: 'post',
            data: {'type': 1}
          }).then(({data}) => {
            this.employeesOptions = data.data
          })
        }
      },
      initOrgTree () {
        this.$http({
          url: this.$http.adornUrl('/tenant/tenantDeptInfo/tree'),
          method: 'get',
          params: {}
        }).then(({data}) => {
          if (data && data.code === 0) {
            this.treeData = [data.deptInfo]
            // 默认保管人
          } else {
            this.treeData = []
          }
        })
      }
    }
  }
</script>

<style lang="scss" scoped>
/deep/.upload-ss{
.div-ssup{
  .el-upload-list__item-actions{
    .delete-sse{
      z-index:10
    }
  }
}
}
/deep/.baoguanren{
  .el-input--suffix .el-input__inner{
  height: 36px !important;
  }
}
.cuowu{
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 18px;
  color: red;
  font-weight: 700;
}
.button-see{
  font-size: 14px;
}
.col-buttons{
  float: right;
}
.div-mau{
  background-color: #ffffff;
}
// .itemCheck{
//   display: flex;
//   // justify-content: center;
//   align-items: center;
// }
    .demo-drawer {
        &__content {
            display: flex;
            flex-direction: column;
            height: 100%;
            form {
                flex: 1;
            }
        }
        &__footer {
            display: flex;
            button {
                flex: 1;
            }
        }
        &__header {
            text-align:right;
            margin-bottom:20px;
            width:100%;
        }
    }
    // 返回按钮
    .center-s{
      overflow: hidden;
      height: 38px;
      line-height: 38px;
      margin-bottom: 3px;
      h3{
        margin-left:30px;
        float: left;
      }
      h5{
        float: left;
        font-weight: 400;
        margin-left: 30px;
        color: orangered;
      }
      .clickBack{
      float: right;
      margin-right: 20px;
      }
    }
    .el-drawer__body {
        padding: 20px;
    }

    .el-upload-dragger{
      width: 100%;
    }
    .el-input__inner{
      height: 36px;
    }
    .clearfix:after{/*伪元素是行内元素 正常浏览器清除浮动方法*/
        content: "";
        display: block;
        height: 0;
        clear:both;
        visibility: hidden;
    }
   .clearfix{
       *zoom: 1;/*ie6清除浮动的方式 *号只有IE6-IE7执行，其他浏览器不执行*/
   }
   .div-temp{
     padding: 15px !important;
   }
</style>
